package com.agriculture.competition.service.impl;

import com.agriculture.common.core.utils.DateUtils;
import com.agriculture.competition.domain.JaCompetitionTeacher;
import com.agriculture.competition.mapper.JaCompetitionTeacherMapper;
import com.agriculture.competition.service.IJaCompetitionTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 比赛对应的评分老师和最终打分老师Service业务层处理
 *
 * @author agriculture
 * @date 2025-03-04
 */
@Service
public class JaCompetitionTeacherServiceImpl implements IJaCompetitionTeacherService {
    @Autowired
    private JaCompetitionTeacherMapper jaCompetitionTeacherMapper;

    /**
     * 查询比赛对应的评分老师和最终打分老师
     *
     * @param id 比赛对应的评分老师和最终打分老师主键
     * @return 比赛对应的评分老师和最终打分老师
     */
    @Override
    public JaCompetitionTeacher selectJaCompetitionTeacherById(Long id) {
        return jaCompetitionTeacherMapper.selectJaCompetitionTeacherById(id);
    }

    /**
     * 查询比赛对应的评分老师和最终打分老师列表
     *
     * @param jaCompetitionTeacher 比赛对应的评分老师和最终打分老师
     * @return 比赛对应的评分老师和最终打分老师
     */
    @Override
    public List<JaCompetitionTeacher> selectJaCompetitionTeacherList(JaCompetitionTeacher jaCompetitionTeacher) {
        return jaCompetitionTeacherMapper.selectJaCompetitionTeacherList(jaCompetitionTeacher);
    }

    /**
     * 新增比赛对应的评分老师和最终打分老师
     *
     * @param jaCompetitionTeacher 比赛对应的评分老师和最终打分老师
     * @return 结果
     */
    @Override
    public int insertJaCompetitionTeacher(JaCompetitionTeacher jaCompetitionTeacher) {
        jaCompetitionTeacher.setCreateTime(DateUtils.getNowDate());
        return jaCompetitionTeacherMapper.insertJaCompetitionTeacher(jaCompetitionTeacher);
    }

    /**
     * 修改比赛对应的评分老师和最终打分老师
     *
     * @param jaCompetitionTeacher 比赛对应的评分老师和最终打分老师
     * @return 结果
     */
    @Override
    public int updateJaCompetitionTeacher(JaCompetitionTeacher jaCompetitionTeacher) {
        jaCompetitionTeacher.setUpdateTime(DateUtils.getNowDate());
        return jaCompetitionTeacherMapper.updateJaCompetitionTeacher(jaCompetitionTeacher);
    }

    /**
     * 批量删除比赛对应的评分老师和最终打分老师
     *
     * @param ids 需要删除的比赛对应的评分老师和最终打分老师主键
     * @return 结果
     */
    @Override
    public int deleteJaCompetitionTeacherByIds(Long[] ids) {
        return jaCompetitionTeacherMapper.deleteJaCompetitionTeacherByIds(ids);
    }

    /**
     * 删除比赛对应的评分老师和最终打分老师信息
     *
     * @param id 比赛对应的评分老师和最终打分老师主键
     * @return 结果
     */
    @Override
    public int deleteJaCompetitionTeacherById(Long id) {
        return jaCompetitionTeacherMapper.deleteJaCompetitionTeacherById(id);
    }
}
